package com.hex.ds.hdrs.period.task.converter;

import com.hex.ds.hdrs.common.utils.BaseUtil;
import com.hex.ds.hdrs.common.utils.HdrsDateUtil;
import com.hex.ds.hdrs.period.task.dto.MutexPoolDto;
import com.hex.ds.hdrs.period.task.po.MutexPoolGroup;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring", imports = {BaseUtil.class, HdrsDateUtil.class})
public interface IMutexPoolGroupConverter {

    @Mapping(target = "pkId", expression = "java(BaseUtil.getPkId())")
    @Mapping(target = "appCodes", source = "appCodes")
    @Mapping(target = "crtTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "crtUser", expression = "java(BaseUtil.getUserId())")
    @Mapping(target = "upTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "upUser", expression = "java(BaseUtil.getUserId())")
    MutexPoolGroup toMutexPoolGroup(String appCodes, MutexPoolDto mutexPoolDto);

    @Mapping(target = "upTs", expression = "java(HdrsDateUtil.getCurrentTime())")
    @Mapping(target = "upUser", expression = "java(BaseUtil.getUserId())")
    @Mapping(target = "appCodes", source = "appCodes")
    MutexPoolGroup toMutexPoolGroup(MutexPoolDto mutexPoolDto, String appCodes);
}
